
<div class="row">

    <div class='col-md-6'>
        {{Form::model($topic, array('role' => 'form' , 'url' => array('topics/update', $topic->id)))}}

        {{Form::text('title' , null  , array('class' => 'form-control'))}}
        {{Form::textarea('description' , null  , array('class' => 'form-control'))}}

        <select name="category_id">
            @foreach(Category::get() as $cat)
            {{$topic->category->id}}
            @if($topic->category->id == $cat->id)

            <option selected="true" value="{{$cat->id}}">{{$cat->name}}</option>

            @else 
            <option value="{{$cat->id}}">{{$cat->name}}</option>
            @endif

            @endforeach
        </select>
        {{Form::submit()}}
        {{Form::close()}}

        @if ($errors->any())
        <ul>
            {{ implode('', $errors->all('<li class="error">:message</li>')) }}
        </ul>
        @endif
    </div>
    <!---  USE THIS IF HAS SEO -->
    <div class='col-md-6'>
        <?php
        $seoble_type = 'Topic';
        $seoble_id = $topic->id;
        $seo = $topic->seo()->first();
        ?>
        @if(is_null($seo))
        @include('seos.create')
        @else 
        @include('seos.edit')
        @endif
    </div>
</div>

CONTENT 
{{ Form::open(array('route' => 'contents.store' , 'method' => 'post')) }}

{{Form::formField('before_url', null , 'Before Image URL')}}
{{Form::formField('after_url', null , 'After Image URL')}}
{{Form::formField('year', null , 'Year')}}

{{Form::submit()}}
{{Form::hidden('topic_id' , $topic->id)}}
{{Form::close()}}


<table class="table">
    @foreach($topic->contents()->get() as $content)
    <tr>
        <td>{{$content->getBefore()}}</td>
        <td>{{$content->getAfter()}}</td>
        <td>{{$content->year}}</td>
        <td id='topic{{$content->id}}}}'>
            <a class="btn btn-warning" href="{{URL::to('contents/'.$content->id.'/edit')}}">Edit</a>
            <a  class="btn btn-danger" href="javascript:checkDelete('{{URL::to('contents')}}' , 'contents' , {{$content->id}});">Delete</a>
        </td>
    </tr>
    @endforeach
</table>

@include('general.google')

@if ($errors->any())
<ul>
    {{ implode('', $errors->all('<li class="error">:message</li>')) }}
</ul>
@endif